﻿Imports BUS
Imports DTO
Public Class ThemKhoiLop

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub

    Private Sub btnthem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthem.Click
        Try
            Dim _KLdto As New CKhoiLopDTO()
            _KLdto.TenKhoiLop = cbbkhoilop.Text
            _KLdto.SoLuongLop = Int32.Parse(txtsoluonglop.Text)
            Dim _Bus As New CKhoiLopBUS()

            If _Bus.ThemKhoiLop(_KLdto) > 0 Then
                MessageBox.Show("Them Khoi Lop Thanh Cong")
            Else
                MessageBox.Show("Them Khoi Lop That Bai")
            End If
        Catch ex As Exception
            MessageBox.Show("Loi --> " + ex.ToString())
        End Try
        
    End Sub

    Private Sub ThemKhoiLop_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Bus As New CKhoiLopBUS()
        Dim _danhsachkhoilop As List(Of CKhoiLopDTO)
        _danhsachkhoilop = Bus.LayDanhSachKhoiLop()
        cbbkhoilop.DataSource = _danhsachkhoilop
        cbbkhoilop.DisplayMember = "TenKhoiLop"
        cbbkhoilop.ValueMember = "MaKhoiLop"
    End Sub
End Class